﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace Exam.Core.Model {
    [Serializable]
    public class Paper : INotifyPropertyChanged, IComparable<Paper> {

        public Paper() {
            _paperID = "";
            _paperName = "";
            _paperDesc = "";
            _paperTime = "";
            _creatTime = "";
            _starTime = "";
            _endTime = "";
            _paperContent = "";
            _paperType = "";
            _courseId = "";
            _departmentID = "";
            _allowRe = "";
            _isCurrExam = "";
        }


        #region
        private string _paperID;

        public string PaperID {
            get { return _paperID; }
            set { _paperID = value; }
        }
        private string _paperName;

        public string PaperName {
            get { return _paperName; }
            set {
                if (_paperName != value) {
                    NotifyPropertyChanged("PaperName");
                    _paperName = value;
                }
            }
        }
        private string _paperDesc;

        public string PaperDesc {
            get { return _paperDesc; }
            set {
                if (_paperDesc != value) {
                    NotifyPropertyChanged("PaperDesc");
                    _paperDesc = value;
                }
            }
        }
        private string _paperTime;

        public string PaperTime {
            get { return _paperTime; }
            set {
                if (_paperTime != value) {
                    NotifyPropertyChanged("PaperTime");
                    _paperTime = value;
                }
                //_paperTime = value;
            }
        }
        private string _creatTime;

        public string CreatTime {
            get { return _creatTime; }
            set { _creatTime = value; }
        }
        private string _starTime;

        public string StarTime {
            get { return _starTime; }
            set { _starTime = value; }
        }
        private string _endTime;

        public string EndTime {
            get { return _endTime; }
            set { _endTime = value; }
        }
        private string _paperContent;

        public string PaperContent {
            get { return _paperContent; }
            set { _paperContent = value; }
        }

        private string _paperType;

        public string PaperType {
            get { return _paperType; }
            set { _paperType = value; }
        }

        private string _courseId;

        public string CourseId {
            get { return _courseId; }
            set { _courseId = value; }
        }

        private string _departmentID;

        public string DepartmentID {
            get { return _departmentID; }
            set { _departmentID = value; }
        }

        private string _allowRe;

        public string AllowRe {
            get { return _allowRe; }
            set { _allowRe = value; }
        }

        private string _isCurrExam;

        public string IsCurrExam {
            get { return _isCurrExam; }
            set { _isCurrExam = value; }
        }

        private List<PaperQuestionType> _paperQuestionTypes;
        public List<PaperQuestionType> PaperQuestionTypes {
            get { return _paperQuestionTypes; }
            set {
                _paperQuestionTypes = value; 
            }
        }

        #endregion


        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info){
            if(PropertyChanged !=null){
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

        #region IComparable<Paper> 成员

        public int CompareTo(Paper other) {
            return int.Parse(other._paperID).CompareTo(int.Parse(this._paperID));
        }

        #endregion
   
    
    }
}
